package com.meritdata.cloud.data.service.approval.service.impl;

import com.meritdata.cloud.data.service.approval.repository.TdDownloadProposeRecordRepository;
import com.meritdata.cloud.data.service.approval.repository.TdDownloadProposeRepository;
import com.meritdata.cloud.data.service.approval.service.IDownloadProposeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class DownloadProposeRecordService implements IDownloadProposeRecordService {

    @Autowired
    private TdDownloadProposeRecordRepository tdDownloadProposeRecordRepository;

    @Autowired
    private TdDownloadProposeRepository tdDownloadProposeRepository;

    @Override
    public boolean dealApprovalInfo(Long proposerId, String operator, int operateType, String text) {
        /*SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
        String dateStr = simpleDateFormat.format(new Date());
        Date operateTime = null;
        try {
            operateTime = simpleDateFormat.parse(dateStr);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        //插入数据审批日志信息
        tdDownloadProposeRecordRepository.insertApprovalInfo(proposerId, operator, operateType, text, operateTime);

        //更新数据下载申请表信息
        if(operateType == 0){
            //0：未通过，1：通过
            tdDownloadProposeRepository.updateApprovalNoInfo(proposerId,2,text,operateTime,0);
        }else{
            tdDownloadProposeRepository.updateApprovalYesInfo(proposerId,1,text,operateTime);
        }*/
        return true;
    }
}
